package com.wc.alorithm_blue_bridge._数据结构.线段树.Q8415;



import java.io.*;
import java.util.StringTokenizer;

/**
 * @Author congege
 * @Description 构造和为偶数
 * https://www.lanqiao.cn/problems/8415/learning/?page=1&first_category_id=1
 * @Date Created in 2023/12/15-13:46
 */
public class Main {
    static int maxN = (int) 1e5 + 10;
    static int mod = 998244353;
    static Node[] tree = new Node[maxN << 2];
    static int[] array = new int[maxN];
    static int n, m;


    static class Node {
        // 基数个数
        int oddNum;
        // 偶数个数
        int evenNum;

        Node(int x) {
            this.oddNum = (x + 1) >> 1;
            this.evenNum = (x >> 1) + 1;
        }

        Node(int oddNum, int evenNum) {
            this.oddNum = oddNum;
            this.evenNum = evenNum;
        }

        Node mul(Node node1) {
            int oddNum = (int) (((long) this.evenNum * node1.oddNum + (long) this.oddNum * node1.evenNum) % mod);
            int evenNum = (int) (((long) this.evenNum * node1.evenNum + (long) this.oddNum * node1.oddNum) % mod);
            return new Node(oddNum, evenNum);
        }
    }

    private static void build(int l, int r, int t) {
        if (l == r) {
            tree[t] = new Node(array[l]);
            return;
        }
        int mid = (l + r) >> 1;
        build(l, mid, t << 1);
        build(mid + 1, r, t << 1 | 1);
        tree[t] = tree[t << 1].mul(tree[t << 1 | 1]);
    }

    private static void update(int l, int r, int t, int pos, int v) {
        if (l == r) {
            tree[t] = new Node(v);
            return;
        }
        int mid = (l + r) >> 1;
        if (pos <= mid) {
            update(l, mid, t << 1, pos, v);
        } else {
            update(mid + 1, r, t << 1 | 1, pos, v);
        }
        tree[t] = tree[t << 1].mul(tree[t << 1 | 1]);
    }

    private static int getAns() {
        return tree[1].evenNum;
    }

    static FastReader in = new FastReader();
    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    public static void main(String[] args) {
        n = in.nextInt();
        m = in.nextInt();
        for (int i = 1; i <= n; i++) {
            array[i] = in.nextInt();
        }
        build(1, n, 1);
        while (m-- > 0) {
            int u = in.nextInt();
            int v = in.nextInt();
            update(1, n, 1, u, v);
            out.println(getAns());
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }
}
